/*
 * QTextArea.h  0.4.0 / Dec 04, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
#ifndef QTEXTAREAADAPTER_H
#define QTEXTAREAADAPTER_H

#include "Cute4jSwing.h"

#include "QTextDocumentAdapter.h"

// QTextArea Class. ------------------------------------------------------------

class TextAreaDelegate;

/*!
 * \brief Text Area.
 *
 * \author Slobodan Vrkacevic
 * \version 0.4.0
 */
class CUTE4J_EXPORT QTextArea : public QTextEdit
{
  Q_OBJECT
protected:
  friend class TextAreaDelegate;
  QTextArea(TextAreaDelegate *delegate);
  virtual ~QTextArea();
protected:
  void setDocument(QTextDocumentAdapter *document);
  void setPaintView(bool paintView);
  void paintView(jlong graphicsPointer);
  void connectSignals();
  void disconnectSignals();
protected slots:
  void destroyingSlot();
  void valueChangedSlot(int value);
  void textClearedSlot();
  void textSetSlot();
  void textAppendedSlot();
  void copyAvailableSlot(bool available);
  void selectAllAvailableSlot(bool available);
protected:
  virtual void paintEvent(QPaintEvent *e);
private:
  QTextDocumentAdapter *m_document;
  bool m_paintView;
  TextAreaDelegate *m_delegate;
  QPaintEvent *m_paintViewEvent;
private:
  static QTextDocument *sm_defaultDocument;
  static int sm_defaultDocumentCount;
};

#endif // QTEXTAREAADAPTER_H
